<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" data-multiple="false" data-params='{"custom[is_house_owner]":1}'  class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Zone')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-zone_id" data-rule="required" data-source="building/zone/getZone" class="form-control selectpage" name="row[zone_id]" type="text" value="{$row.zone_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Build_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-build_id" data-rule="required" data-source="building/building/index" class="form-control selectpage" name="row[build_id]" type="text" value="{$row.build_id|htmlentities}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.house.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select  id="c-type" data-rule="required" class="form-control selectpicker" name="row[type]">
                {foreach name="typeList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('House_type')}:</label>
        <div id="house-residence" class="col-xs-12 col-sm-8" {eq name="row.type" value="1"}style="display: none"{/eq}>
            <div style="display: flex; width: 418px">
                <input id="c-house-save-type" name="row[house_save_type]" type="hidden" value="select">
                <input id="c-house_type_name" class="form-control" name="row[house_type_name]" type="text" style="display: none" placeholder="直接输入户型">
                <select id="c-house_type" class="form-control selectpicker" name="row[house_type]" placeholder="请选择户型">
                    {foreach name="houseTypeList" item="vo"}
                    <option value="{$vo.name}" {in name="vo.name" value="$row.house_type"}selected{/in}>{$vo.name}</option>
                    {/foreach}
                </select>
                <div class="input-group-addon no-border no-padding">
                    <button id="c-house_type-btn" type="button" class="btn btn-primary">添加户型</button>
                </div>
            </div>
        </div>
        <div id="house-not-residence" class="col-xs-12 col-sm-8" {neq name="row.type" value="1"}style="display: none"{/neq}>
            <div style="display: flex;">
                <div style="display: flex; margin-right: 16px; align-items: center">
                    <span style="width: 60px">卧室:</span>
                    <input id="c-room_num" class="form-control" name="row[room_num]" type="number" value="{$row.room_num}">
                </div>
                <div style="display: flex; margin-right: 16px; align-items: center">
                    <span style="width: 60px">客厅:</span>
                    <input id="c-ting_num" class="form-control" name="row[ting_num]" type="number" value="{$row.ting_num}">
                </div>
                <div style="display: flex; align-items: center">
                    <span style="width: 80px">卫生间:</span>
                    <input id="c-toilet_num" class="form-control" name="row[toilet_num]" type="number" value="{$row.toilet_num}">
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Area')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-area" class="form-control" step="0.01" name="row[area]" type="number" value="{$row.area|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Floor_no')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-floor_no" data-rule="required" class="form-control" name="row[floor_no]" type="number" value="{$row.floor_no|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Rent')}:</label>
        <div class="col-xs-12 col-sm-8" style="display: flex;">
            <div style="width: 180px">
                <select id="c-payment_type" class="form-control selectpicker" name="row[payment_type]">
                    {foreach name="paymentTypeList" item="vo"}
                    <option value="{$vo}" {in name="vo" value="$row.house.payment_type"}selected{/in}>{$vo}</option>
                    {/foreach}
                </select>
            </div>
            <input id="c-rent" data-rule="required" class="form-control" step="0.01" name="row[rent]" type="number" value="{$row.house.rent|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">位置:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.house.address|htmlentities}">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">社区:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <select id="c-community" class="form-control selectpicker" name="row[community]">-->
<!--                {foreach name="communityList" item="vo"}-->
<!--                <option value="{$vo.option_id}" {in name="vo.option_id" value="$row.house.community"}selected{/in}>{$vo.option_name}</option>-->
<!--                {/foreach}-->
<!--            </select>-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">联系电话:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-mobile" class="form-control" name="row[mobile]" type="tel" value="{$row.house.mobile|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">其他费用:</label>
        <div class="col-xs-12 col-sm-8" style="display: flex; flex-wrap: wrap; justify-content: space-between">
            {foreach $costList as $k => $vo}
            <div style="display: flex; width: 48%; height: 100%; align-items: center">
                <label style="width: 160px">
                    <input type="checkbox" name="row[fixed][{$k}][checked]" value="{$vo.id}" {if condition="!empty($row['fixed'][$vo['id']])"}checked{/if}>
                    <span>{$vo.name}</span>
                </label>
                <input id="c-fixed-{$k}" class="form-control" name="row[fixed][{$k}][price]" step="0.01" type="number" value="{$row['fixed'][$vo['id']]['price'] ?? ''}">
                <input name="row[fixed][{$k}][id]" type="hidden" value="{$vo.id}">
                <input name="row[fixed][{$k}][name]" type="hidden" value="{$vo.name}">
            </div>
            {/foreach}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房源标签:</label>
        <div class="col-xs-12 col-sm-8" style="display: flex; flex-wrap: wrap; height: 100%; align-items: center;">
            {foreach $tagList as $k => $vo}
            <label style="margin-right: 12px">
                <input type="checkbox" {in name="vo.option_id" value="$row.house.tags"}checked{/in} name="row[tags][{$k}]" value="{$vo.option_id}">
                <span>{$vo.option_name}</span>
            </label>
            {/foreach}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间设施:</label>
        <div class="col-xs-12 col-sm-8" style="display: flex; flex-wrap: wrap; height: 100%; align-items: center;">
            {foreach $peitaoList as $k => $vo}
            <label style="margin-right: 12px">
                <input type="checkbox" {in name="vo.option_id" value="$row.pt"}checked{/in} name="row[pt][{$k}][checked]" value="{$vo.option_id}">
                <span>{$vo.option_name}</span>
            </label>
            <input name="row[pt][{$k}][id]" type="hidden" value="{$vo.option_id}">
            <input name="row[pt][{$k}][name]" type="hidden" value="{$vo.option_name}">
            {/foreach}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">封面图片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-cover" class="form-control" size="50" name="row[cover]" type="text" value="{$row.house.cover|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-cover" class="btn btn-danger faupload" data-input-id="c-cover" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-preview-id="p-cover"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-cover" class="btn btn-primary fachoose" data-input-id="c-cover" data-mimetype="image/*"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-cover"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-cover"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">视频介绍:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-video" class="form-control" size="50" name="row[video]" type="text" value="{$row.house.video|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-video" class="btn btn-danger faupload" data-input-id="c-video" data-mimetype="video/*" data-preview-id="p-video"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-video" class="btn btn-primary fachoose" data-input-id="c-video" data-mimetype="video/*"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-video"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-video"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房源介绍:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-intro" class="form-control" name="row[intro]" type="text" value="{$row.house.intro|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">入住须知:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-notice" class="form-control" name="row[notice]" type="text" value="{$row.house.notice|htmlentities}">
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
